package com.glela.statistics.service.impl;

import com.glela.platform.mapper.UserMapper;
import com.glela.platform.model.User;
import com.glela.statistics.mapper.OrderStatisticsMapper;
import com.glela.statistics.model.OrderQueryTotal;
import com.glela.statistics.model.request.StoreCenterRequest;
import com.glela.statistics.model.response.StoreCenterOrderResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author gwq
 *
 */
@Service("statisticsServiceImpl0")
@Order(0)
public class StatisticsServiceImpl0 extends AbstractStatisticsServiceImpl {
	@Autowired
	private OrderStatisticsMapper orderStatisticsMapper;
	@Autowired
	private UserMapper userMapper;
	   
	public Long selectStoreNumber(long userId) {
		// TODO Auto-generated method stub
		User user = userMapper.selectUserBaseInfoById(userId);
		if (user.getRoleId() != 7) {
			return 0L;
		}
		Map<String,Object> queryMap = new HashMap<String,Object>();
		queryMap.put("id", user.getId());
		queryMap.put("talentTeacher", user.getPersionId());
		Long resModel = orderStatisticsMapper.selectStoreStudentNum(queryMap);
		return resModel==null?0L:resModel;
	}

	public Long selectUnderStoreNumber(long userId){
		User user = userMapper.selectUserBaseInfoById(userId);
		if (user.getRoleId() != 7) {
			return 0L;
		}
		Map<String,Object> queryMap = new HashMap<String,Object>();
		queryMap.put("id", user.getId());
		queryMap.put("talentTeacher", user.getPersionId());
		Long resModel = orderStatisticsMapper.selectUnderStoreStudentNum(queryMap);
		return resModel==null?0L:resModel;
	}

	@Override
	public StoreCenterOrderResponse selectOrderDetailByOrderInfoIdsNew(StoreCenterRequest selectCondition) {
		return null;
	}
	@Override
	public OrderQueryTotal selectOrderTotal(StoreCenterRequest selectCondition){
		return null;
	}
}
